


<template>
    <view class="business_container">
        <!-- #ifdef MP-WEIXIN -->
        <fl-navBar dark :border="false" title="" color="#333333" :fixed="true" background-color="transparent" status-bar />
        <!-- #endif -->
        <!-- #ifdef H5 -->
        <fl-navBar dark height="20px" :border="false" title="" color="#333333" :fixed="true" background-color="transparent"
            status-bar />
        <!-- #endif -->


        <!-- 头部搜索 -->
        <Search @inputChange="inputChange" />
        <view class="menus_box">
            <fl-menu @changeMenus="changeMenus" />
        </view>
        <view class="doc_common_container" v-if="menusTabs.length > 0">
            <ReceiveWander :bumphTitle="bumphTitle" :isRead="isRead" v-if="menuId == 0" />
            <ReadList :bumphTitle="bumphTitle" :isRead="isRead" v-if="menuId == 1" />
            <Agent :bumphTitle="bumphTitle" :isRead="isRead" v-if="menuId == 2" />
            <DocReceive :bumphTitle="bumphTitle" :isRead="isRead" v-if="menuId == 3" />
            <NoticeReceive :isRead="isRead" :bumphTitle="bumphTitle" v-if="menuId == 4" />
        </view>
    </view>
</template> 
<script setup>
import Search from './component/Search.vue'
import { ref } from 'vue'
import store from '@/store'
import { getToken } from '@/utils/auth'
import { onShow, onLoad } from "@dcloudio/uni-app";
// 收文阅办
import ReadList from './readList.vue'
// 收文流转
import ReceiveWander from './receiveWander.vue'
// 阅办代理
import Agent from './agent.vue'
// 公文接收
import DocReceive from './docReceive.vue'
// 通知接收
import NoticeReceive from './noticeReceive.vue'

const bumphTitle = ref('')
const { menusTabs } = store.getters
const menuId = ref(0)
const isRead = ref('')//是否阅办完成了 完成后通知去更新

if (menusTabs.length > 0) {
    menuId.value = menusTabs[0].id
}
// 头部文本框搜索
const inputChange = (val) => {
    bumphTitle.value = val
}
const changeMenus = (item) => {
    menuId.value = item.id
}
onLoad(() => {
    if (!getToken()) {
        uni.reLaunch({ url: '/pages/login' })
    }
})
onShow(() => {
    // uni.$on('propsUser', (e) => {
    //     users.value = e
    //     uni.$off('propsUser')
    //})
    uni.$on('read', () => {
        isRead.value = new Date().getTime() + Math.random()
        uni.$off('read')
    })
})
</script>


<style scoped lang="scss">
page {
    height: 100%;
    overflow: hidden;
    background-color: #fff;
}

.business_container {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: url('@/static/images/loginform_back.png') no-repeat;
    background-size: 100% auto;

    .doc_common_container {
        flex: 1;
        height: 100%;
        overflow: hidden;
        background-color: #fff;
    }
}
</style>
